package com.example.androiddevchallenge.screens.home

import androidx.annotation.StringRes
import androidx.compose.foundation.layout.RowScope
import androidx.compose.material.BottomNavigationItem
import androidx.compose.material.Icon
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AccountCircle
import androidx.compose.material.icons.filled.FavoriteBorder
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.ShoppingCart
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import com.example.androiddevchallenge.R
import com.example.androiddevchallenge.ui.compoents.BloomBottomNav

@Composable
fun HomeScreenBottomNav() {
    BloomBottomNav {
        HomeBottomNavItem(
            icon = Icons.Filled.Home,
            labelRes = R.string.home,
            selected = true,
            onClick = { /*TODO*/ }
        )
        HomeBottomNavItem(
            icon = Icons.Filled.FavoriteBorder,
            labelRes = R.string.favorites,
            selected = true,
            onClick = { /*TODO*/ }
        )
        HomeBottomNavItem(
            icon = Icons.Filled.AccountCircle,
            labelRes = R.string.profile,
            selected = true,
            onClick = {

            }
        )
        HomeBottomNavItem(
            icon = Icons.Filled.ShoppingCart,
            labelRes = R.string.cart,
            selected = true,
            onClick = { /*TODO*/ }
        )
    }
}

@Composable
fun RowScope.HomeBottomNavItem(
    icon: ImageVector,
    @StringRes labelRes: Int,
    selected: Boolean,
    onClick: () -> Unit
) {
    BottomNavigationItem(
        selected = selected,
        onClick = onClick,
        icon = {
            Icon(
                imageVector = icon,
                contentDescription = ""
            )
        },
        label = {
            Text(
                text = stringResource(id = labelRes),
                style = MaterialTheme.typography.caption
            )
        })
}

@Preview
@Composable
fun HomeNavBottomPreview() {
    HomeScreenBottomNav()
}